package com.github.bitsapling.sapling.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 传输历史记录表
 * </p>
 *
 */
@TableName("transfer_history")
public class TransferHistory implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 自增主键ID，唯一标识每条传输记录
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 关联的用户ID，外键关联到用户表
     */
    private Long userId;

    /**
     * 关联的种子ID，外键关联到torrent表
     */
    private Long torrentId;

    /**
     * 剩余需要传输的数据量（字节），默认为0
     */
    private Long leftByte;

    /**
     * 传输开始时间，默认为2025-01-01 08:00:00
     */
    private LocalDateTime startedAt;

    /**
     * 传输最后更新时间，默认为2025-01-01 08:00:00
     */
    private LocalDateTime updatedAt;

    /**
     * 已上传的数据总量（字节）
     */
    private Long uploaded;

    /**
     * 已下载的数据总量（字节）
     */
    private Long downloaded;

    /**
     * 实际上传的数据量（排除重复上传等，字节）
     */
    private Long actualUploaded;

    /**
     * 实际下载的数据量（排除重复下载等，字节）
     */
    private Long actualDownloaded;

    /**
     * 当前上传速度（字节/秒）
     */
    private Long uploadSpeed;

    /**
     * 当前下载速度（字节/秒）
     */
    private Long downloadSpeed;

    /**
     * 最后发生的传输事件类型（如"upload"、"download"、"pause"等）
     */
    private String lastEvent;

    /**
     * 是否拥有完整的传输历史记录（true/false）
     */
    private Boolean haveCompleteHistory;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getTorrentId() {
        return torrentId;
    }

    public void setTorrentId(Long torrentId) {
        this.torrentId = torrentId;
    }

    public Long getLeftByte() {
        return leftByte;
    }

    public void setLeftByte(Long leftByte) {
        this.leftByte = leftByte;
    }

    public LocalDateTime getStartedAt() {
        return startedAt;
    }

    public void setStartedAt(LocalDateTime startedAt) {
        this.startedAt = startedAt;
    }

    public LocalDateTime getUpdatedAt() {
        return updatedAt;
    }

    public void setUpdatedAt(LocalDateTime updatedAt) {
        this.updatedAt = updatedAt;
    }

    public Long getUploaded() {
        return uploaded;
    }

    public void setUploaded(Long uploaded) {
        this.uploaded = uploaded;
    }

    public Long getDownloaded() {
        return downloaded;
    }

    public void setDownloaded(Long downloaded) {
        this.downloaded = downloaded;
    }

    public Long getActualUploaded() {
        return actualUploaded;
    }

    public void setActualUploaded(Long actualUploaded) {
        this.actualUploaded = actualUploaded;
    }

    public Long getActualDownloaded() {
        return actualDownloaded;
    }

    public void setActualDownloaded(Long actualDownloaded) {
        this.actualDownloaded = actualDownloaded;
    }

    public Long getUploadSpeed() {
        return uploadSpeed;
    }

    public void setUploadSpeed(Long uploadSpeed) {
        this.uploadSpeed = uploadSpeed;
    }

    public Long getDownloadSpeed() {
        return downloadSpeed;
    }

    public void setDownloadSpeed(Long downloadSpeed) {
        this.downloadSpeed = downloadSpeed;
    }

    public String getLastEvent() {
        return lastEvent;
    }

    public void setLastEvent(String lastEvent) {
        this.lastEvent = lastEvent;
    }

    public Boolean getHaveCompleteHistory() {
        return haveCompleteHistory;
    }

    public void setHaveCompleteHistory(Boolean haveCompleteHistory) {
        this.haveCompleteHistory = haveCompleteHistory;
    }

    @Override
    public String toString() {
        return "TransferHistory{" +
        "id = " + id +
        ", userId = " + userId +
        ", torrentId = " + torrentId +
        ", leftByte = " + leftByte +
        ", startedAt = " + startedAt +
        ", updatedAt = " + updatedAt +
        ", uploaded = " + uploaded +
        ", downloaded = " + downloaded +
        ", actualUploaded = " + actualUploaded +
        ", actualDownloaded = " + actualDownloaded +
        ", uploadSpeed = " + uploadSpeed +
        ", downloadSpeed = " + downloadSpeed +
        ", lastEvent = " + lastEvent +
        ", haveCompleteHistory = " + haveCompleteHistory +
        "}";
    }
}
